package com.sanri.buildingblock.exportcenter.enums;

/**
 * @description:
 * @author: huangzhengri
 * @time: 2023-04-14 15:49
 */
public enum TaskStatus {
    /**
     * 排队中
     */
    QUEUE(1),
    /**
     * 运行中
     */
    RUN(2),
    /**
     * 执行成功
     */
    SUCCESS(3),
    /**
     * 执行失败
     */
    FAIL(4);
    private final int code;

    TaskStatus(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public static TaskStatus getTaskStatusByCode(int code){
       switch (code){
           case 1:
               return QUEUE;
           case 2:
               return RUN;
           case 3:
               return SUCCESS;
           case 4:
           default:
               return FAIL;
       }
    }
}
